package com.njtoyo.taxi.admin.rest.wrapper.business.company;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

@ApiModel("修改公司手续费模型")
@Data
public class CompanFreeRateWrapper implements Serializable {

    @ApiModelProperty(value = "公司手续费配置")
    @Valid
    private List<CompanyFeeRates> companyFeeRates;

    @Data
    @Valid
    public static class CompanyFeeRates {
        @ApiModelProperty(value = "司机可得分成比（按照/1000获取百分比）")
        @Range(min = 0, max = 1000, message = "司机分成比只能在0-1000之间")
        @NotNull(message = "司机分成比不能为空")
        private Integer driverEarningRatio;

        @ApiModelProperty(value = "公司可得分成比（按照/1000获取百分比）")
        @Range(min = 0, max = 1000, message = "司机分成比只能在0-1000之间")
        @NotNull(message = "公司可得分成比不能为空")
        private Integer companyEarningRatio;

        @ApiModelProperty(value = "最高收取的手续费(单位:元)")
        @Digits(integer = 5, fraction = 2, message = "金额格式不正确")
        @DecimalMin(value = "0.00", message = "金额格式不为负")
        private BigDecimal maxFee;

        @ApiModelProperty(value = "开始时间")
        @NotNull(message = "开始时间不能为空")
        private String startTimestamp;

        @ApiModelProperty(value = "结束时间,时间为空,则长期有效")
        private String endTimestamp;
    }
}
